package com.xpgk.mvc.todayMeasure;

import java.util.List;
import java.util.logging.Logger;

import com.jfinal.aop.Before;
import com.jfinal.log.Log;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.activerecord.tx.Tx;
import com.xpgk.config.Config;
import com.xpgk.mvc.base.BaseController;
import com.xpgk.mvc.measurement.Temporary;

public class TodayMeasureController extends BaseController {

	private TodayMeasureServices todayMeasureServices = new TodayMeasureServices();
	private static final Log log = Log.getLog(TodayMeasureController.class);
	/*
	 * 今日测算页面跳转
	 */
	public void index(){
		render("todayMeasure.html");
	}
	
	/*
	 * 测算信息删除
	 */
	@Before(Tx.class)
	public void updatedataStatus(){
		String phone = getPara("ids");
		Temporary temporary = Temporary.dao.findById(ids);
		temporary.set("datastatus", 0);
		System.out.println(temporary);
		boolean update = temporary.update();
		renderJson(update);
	}
	
	/*
	 * 今日测算查询
	 */
	public void todaymeasure(){
		
		//获取当前机构id
		String todaydate = getPara("todaydate");
    	String organids=getCUserOrganIds();
		List<Record> result = todayMeasureServices.todaymeasure(organids,todaydate);
		renderJson(result);
	}
}
